﻿/*********************************************************************************
**                                                                              **
**  Copyright (C) 2022-2022 LiLong                                              **
**  This file is part of BluetoothCpp.                                          **
**                                                                              **
**  BluetoothCpp is free software: you can redistribute it and/or modify        **
**  it under the terms of the GNU Lesser General Public License as published by **
**  the Free Software Foundation, either version 3 of the License, or           **
**  (at your option) any later version.                                         **
**                                                                              **
**  BluetoothCpp is distributed in the hope that it will be useful,             **
**  but WITHOUT ANY WARRANTY; without even the implied warranty of              **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               **
**  GNU Lesser General Public License for more details.                         **
**                                                                              **
**  You should have received a copy of the GNU Lesser General Public License    **
**  along with BluetoothCpp.  If not, see <https://www.gnu.org/licenses/>.      **
**********************************************************************************/
#pragma once

#include "BluetoothCppGlobal.h"

#include <memory>
#include <string>

#if defined(WIN32) || defined(Q_CLANG_QDOC)
#ifndef GUID_DEFINED
#define GUID_DEFINED
typedef struct _GUID
{
    unsigned long Data1;
    unsigned short Data2;
    unsigned short Data3;
    unsigned char Data4[8];
} GUID, *REFGUID, *LPGUID;
#endif
#endif

namespace BTH
{
class BTH_EXPORT Uuid
{
public:
    Uuid() noexcept;
    Uuid(unsigned short uuid) noexcept;
    Uuid(unsigned int uuid) noexcept;
#ifdef WIN32
    Uuid(const GUID& guid) noexcept;
#endif
    Uuid(std::string_view uuid);
    Uuid(const Uuid& other) noexcept;
    Uuid(Uuid&& other) noexcept;
    ~Uuid() noexcept;

    std::string toString() const noexcept;
    Uuid& operator=(const Uuid& other) noexcept;
    Uuid& operator=(Uuid&& other) noexcept;
#ifdef WIN32
    operator GUID() const noexcept;
#endif

private:
    struct Impl;
    std::unique_ptr<Impl> m_impl;
};
} // namespace BTH
